package org.msfj.common.feign;

import org.msfj.authority.client.configuration.ClientAutoConfiguration;
import org.msfj.common.model.CommonResult;
import org.msfj.common.submail.SubMailMessage;
import org.msfj.common.submail.SubMailMessages;
import org.msfj.common.submail.SubMailTemplate;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(value = "common-service", configuration = {ClientAutoConfiguration.class})
public interface SubmailApi {

    /**
     * 根据短信模板ID发送单条短信
     *
     * @param projectId
     * @param subMailMessage
     * @return
     */
    @RequestMapping(value = "/api/submail/sendSingle", method = RequestMethod.POST)
    CommonResult<Boolean> sendSingle(@RequestParam("projectId") String projectId, @RequestBody SubMailMessage subMailMessage);

    /**
     * 根据短信模板ID发送多条短信
     *
     * @param projectId
     * @param subMailMessageList
     * @return
     */
    @RequestMapping(value = "/api/submail/sendMutil", method = RequestMethod.POST)
    CommonResult<Boolean> sendMutil(@RequestParam("projectId") String projectId, @RequestBody SubMailMessages subMailMessageList);

    /**
     * 获取短信模板列表
     *
     * @return
     */
    @RequestMapping("/api/submail/getTemplateList")
    CommonResult<List<SubMailTemplate>> getTemplateList();

    /**
     * 插入短信模板
     *
     * @param subMailTemplateVo
     * @return
     */
    @RequestMapping(value = "/api/submail/insertTemplate", method = RequestMethod.POST)
    CommonResult<SubMailTemplate> insertTemplate(@RequestBody SubMailTemplate subMailTemplateVo);

    /**
     * 更新短信模板
     *
     * @param subMailTemplateVo
     * @return
     */
    @RequestMapping(value = "/api/submail/updateTemplate", method = RequestMethod.POST)
    CommonResult<Boolean> updateTemplate(@RequestBody SubMailTemplate subMailTemplateVo);

    /**
     * 删除短信模板
     *
     * @param subMailTemplateVo
     * @return
     */
    @RequestMapping(value = "/api/submail/deleteTemplate", method = RequestMethod.POST)
    CommonResult<Boolean> deleteTemplate(@RequestBody SubMailTemplate subMailTemplateVo);

    /**
     * 发送短信验证码
     *
     * @param subMailMessage
     * @return
     */
    @RequestMapping(value = "/api/submail/sendCommonPhoneValid", method = RequestMethod.POST)
    CommonResult<Boolean> sendCommonPhoneValid(@RequestBody SubMailMessage subMailMessage);
}
